package be.jaisy.osgi.console.service.api.to;

import java.io.Serializable;

public class BundleTo implements Serializable{

	private static final long serialVersionUID = -4868555372206311760L;
	private Long id;
	private String symbolicName;
	private String version;
	private String state;
	private String vendor;
	
	public BundleTo() {
		super();
	}
	public Long getBundleId() {
		return id;
	}
	public void setBundleId(Long bundleId) {
		this.id = bundleId;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getSymbolicName() {
		return symbolicName;
	}
	public void setSymbolicName(String symbolicName) {
		this.symbolicName = symbolicName;
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	public String getVendor() {
		return vendor;
	}
	public void setVendor(String vendor) {
		this.vendor = vendor;
	}
	public String toString() {
		StringBuffer sb = new StringBuffer(BundleTo.class+" :");
		sb.append("[id="+id+"]");
		sb.append("[state="+state+"]");
		sb.append("[symbolicName="+symbolicName+"]");
		sb.append("[verion="+version+"]");
		sb.append("[vendor="+vendor+"]");
		return sb.toString();
	}

	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((id == null) ? 0 : id.hashCode());
		result = PRIME * result + ((state == null) ? 0 : state.hashCode());
		result = PRIME * result + ((symbolicName == null) ? 0 : symbolicName.hashCode());
		result = PRIME * result + ((version == null) ? 0 : version.hashCode());
		result = PRIME * result + ((vendor == null) ? 0 : vendor.hashCode());
		return result;
	}
	
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
// commented for GWT
//		if (getClass() != obj.getClass())
//			return false;
		final BundleTo other = (BundleTo) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (state == null) {
			if (other.state != null)
				return false;
		} else if (!state.equals(other.state))
			return false;
		if (symbolicName == null) {
			if (other.symbolicName != null)
				return false;
		} else if (!symbolicName.equals(other.symbolicName))
			return false;
		if (version == null) {
			if (other.version != null)
				return false;
		} else if (!version.equals(other.version))
			return false;
		if (vendor == null) {
			if (other.vendor != null)
				return false;
		} else if (!vendor.equals(other.vendor))
			return false;
		return true;
	}
	
	
}
